const app = getApp()
let qCloud = require("../../../index.js");

Page({
  /** 页面的初始数据 */
  data: {
    imgPath: qCloud.config.STATIC_IMAGE_PATH,
    processId: null,
    processName: "",
    subProcessList: []
  },
  /** 生命周期函数--监听页面加载 */
  onLoad: function (options) {
    let self = this;

    if (options.processId) {
      self.setData({
        processId: options.processId
      });
      self.queryProcessDetails();
    }
  },
  /** 查询工序详情 */
  queryProcessDetails: function (e) {
    let self = this;

    let params = {
      processId: self.data.processId
    };
    app.fetchApis(self, qCloud.api.common_queryProcessDetails, params, "POST", function (e) {
      let result = e.data;
      if (result.code == 200) {
        let data = result.data;

        self.setData({
          processName: data.processInfo.processName,
          subProcessList: data.processInfo.subProcessList
        });
      }
    });
  },
  /** 生命周期函数--监听页面初次渲染完成 */
  onReady: function () {},
  /** 生命周期函数--监听页面显示 */
  onShow: function () {},
  /** 生命周期函数--监听页面隐藏 */
  onHide: function () {},
  /** 生命周期函数--监听页面卸载 */
  onUnload: function () {},
  /** 页面相关事件处理函数--监听用户下拉动作 */
  onPullDownRefresh: function () {},
  /** 页面上拉触底事件的处理函数 */
  onReachBottom: function () {},
  /** 用户点击右上角分享 */
  onShareAppMessage: function () {}
});
